package com.itheima.exception;


import com.itheima.pojo.Result;
import lombok.Data;

/**
 * 自定有业务异常
 */
@Data
public class BizException extends RuntimeException{
     // 业务错误码
    private String message;  // 错误信息
    private Object data;     // 可选的数据内容

    public BizException(String message) {
        this.message = message;
    }

    public BizException(String message, Object data) {
        this.message = message;
        this.data = data;
    }

    public Result toErrorResult(){
        return Result.error(this.message);
    }



}
